package com.tanfuqi.sicent.server.handler

import com.tanfuqi.sicent.protocol.message.Member
import com.tanfuqi.sicent.protocol.message.QueryBody
import org.springframework.stereotype.Component
import org.springframework.web.reactive.function.server.ServerRequest
import org.springframework.web.reactive.function.server.ServerResponse.ok
import org.springframework.web.reactive.function.server.body
import reactor.core.publisher.Flux

@Component
class MemberHandler {

    fun get(request: ServerRequest) =
                ok().body(request.bodyToMono(QueryBody::class.java).map {

                })

    fun post(request: ServerRequest) =
            request.bodyToMono(Member::class.java).flatMap {
                ok().body(request.bodyToMono(QueryBody::class.java))
            }
}

//fun main(args: Array<String>) {
//    Flux.just("1","2","3")
//    UUID.randomUUID().toString()
//}